#!/bin/bash

# Join channels
echo "\JOIN TestChannel0" > /tmp/ibrc/ibrc_client0.input
echo "\JOIN TestChannel0" > /tmp/ibrc/ibrc_client1.input
echo "\JOIN TestChannel0" > /tmp/ibrc/ibrc_client2.input

sleep 1

# Send channel messages
echo "Hi its client0 I joined the channel" > /tmp/ibrc/ibrc_client0.input
echo "Hi its client1 I joined the channel" > /tmp/ibrc/ibrc_client1.input
echo "Hi its client2 I joined the channel" > /tmp/ibrc/ibrc_client2.input

sleep 1

# Send private messages
echo "\PRIVMSG client2 Pssst, client1 is an idiot!" > /tmp/ibrc/ibrc_client0.input
echo "\PRIVMSG client0 Definitly! Let's join a new channel without him." > /tmp/ibrc/ibrc_client2.input
echo "\PRIVMSG client2 ok" > /tmp/ibrc/ibrc_client0.input
echo "Is somebody talking about me???" > /tmp/ibrc/ibrc_client1.input

sleep 1

# Change channels
echo "\JOIN ChannelWithoutClient1" > /tmp/ibrc/ibrc_client0.input
echo "\JOIN ChannelWithoutClient1" > /tmp/ibrc/ibrc_client2.input

sleep 1

echo "Finally he's gone..." > /tmp/ibrc/ibrc_client0.input
echo "Feels a lot better!!!" > /tmp/ibrc/ibrc_client2.input

# Private messages that fail duo to channel mismatch
echo "\PRIVMSG client0 Are you still there?" > /tmp/ibrc/ibrc_client1.input
echo "\PRIVMSG client2 Are you still there?" > /tmp/ibrc/ibrc_client1.input
echo "\LIST" > /tmp/ibrc/ibrc_client1.input
